package user

import (
	"context"

	"demo/internal/dao"
	"demo/internal/model/entity"
	"demo/internal/service"
)

type (
	sUser struct{}
)

func init() {
	service.RegisterUser(New())
}

func New() service.IUser {
	return &sUser{}
}

// GetProfile retrieves and returns current user info in session.
func (s *sUser) GetProfile(ctx context.Context, openid string) (out *entity.User) {
	dao.User.Ctx(ctx).Where("openid", openid).Scan(&out)
	return
}
